package com.sun.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.sun.dto.PurchaseDto;
import com.sun.entity.PurchaseHead;
import org.apache.ibatis.annotations.Param;
import org.springframework.transaction.annotation.Transactional;

import java.time.LocalDateTime;
import java.util.List;

/**
 * @Project: hospitalDrugInformationManagement
 * @Author: 86178
 * @Date: 2023/3/21 15:24
 * @FileName: PurchaseHeadService
 * @Description: ""
 */
@SuppressWarnings("all")
public interface PurchaseHeadService extends IService<PurchaseHead> {
    IPage<PurchaseDto> selectPurchaseDtoListPage(@Param("page") IPage<PurchaseDto> page, @Param("userName") String userName, @Param("supplierName") String supplierName, @Param("status") Integer status, LocalDateTime startTime, LocalDateTime endTime);

    List<PurchaseDto> selectPurchaseDtoList(@Param("userName") String userName, @Param("supplierName") String supplierName, Integer status, LocalDateTime startTime, LocalDateTime endTime);

    //新增采购计划
    @Transactional
    public Boolean saveWithPurchaseDetail(PurchaseDto purchaseDto);

    //根据id查询采购单和对应的药品信息
    public PurchaseDto getByIdWithPurchaseDetail(Long id);

    //更新采购单，同时更新对应的药品信息
    @Transactional
    public void updateWithPurchaseDetail(PurchaseDto purchaseDto);

    //根据id删除采购单
    @Transactional
    public Boolean batchDeleteByIds(List<Long> ids);

    @Transactional
    //根据id和status修改采购单状态
    public void updateStatusByIds(Integer status, List<Long> ids);
}
